package com.zqt.zqt805.service.Impl;

import com.zqt.zqt805.domain.Product;
import com.zqt.zqt805.mapper.ProductMapper;
import com.zqt.zqt805.service.ProductService;
import com.zqt.zqt805.util.AjaxResult;
import com.zqt.zqt805.util.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;

    @Override
    public void addProduct(Product product) {
        productMapper.insertProduct(product);

    }

    @Override
    public List<Product> getAllProducts() {
        List<Product> productList = productMapper.selectAllProducts();
        return productList;
    }



    @Override
    public void updateProduct(Product product) {
        productMapper.updateProduct(product);

    }

    @Override
    public void deleteProduct(int productId) {
        productMapper.deleteProduct(productId);

    }
}